package com.example.tongue.ui.Seetongue;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.tongue.R;
import com.example.tongue.ui.Seetongue.Material.Material;
import com.example.tongue.ui.Seetongue.Record.ViewRecord;


public class SeetongueFragment extends Fragment implements View.OnClickListener {

    private Button camera, chooseFromAlbum,viewRecord,material;




    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {


        View view = inflater.inflate(R.layout.seetongue_layout, container,
                false);
        //绑定资源
        chooseFromAlbum = view.findViewById(R.id.Choose_From_Album);
        camera = view.findViewById(R.id.Carmera);
        viewRecord= view.findViewById(R.id.ViewRecord);
        material=view.findViewById(R.id.Material);


        SetListener();


        return view;
    }

/**
 * 为按钮设置监听器
 *
 * */
    private void SetListener(){
        camera.setOnClickListener(this);
        chooseFromAlbum.setOnClickListener(this);
        viewRecord.setOnClickListener(this);
        material.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.Carmera: {
                Intent intent1 = new Intent(getActivity(), Camera.class);
                startActivity(intent1);
            }
            break;

            case R.id.Choose_From_Album: {
                Intent intent2 = new Intent(getActivity(), Albums.class);
                startActivity(intent2);
            }
            break;
            case R.id.ViewRecord: {
                Intent intent3 = new Intent(getActivity(), ViewRecord.class);
                startActivity(intent3);
            }
            break;
            case R.id.Material: {
                Intent intent4 = new Intent(getActivity(), Material.class);
                startActivity(intent4);
            }
            break;

        }
    }
}











